<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>添加用户</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    {include file="public/css"}
    {include file="public/js"}
</head>
<body>
<blockquote class="layui-elem-quote">基本信息</blockquote>
<div  style="padding-top:20px">

<form class="layui-form" >

<div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">头像</label>
                <div class="layui-input-inline" >
                  {:upload_images('上传头像',"avatar",'')}
                </div>
  </div>
            <div class="layui-form-item">
              <label class="layui-form-label" style="width:100px;">用户名</label>
              <div class="layui-input-inline">
                <input type="text" name="username" lay-verify="username" placeholder="用户名" autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux"><span class="orange">*</span></div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">昵称</label>
                <div class="layui-input-inline">
                <input type="text" name="nickname"  placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
            </div>            
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">用户组</label>
                <div class="layui-input-inline" >
                 <select name="level_id" lay-filter="level_id">
                  {volist name="list"  id="vo"}
                    <option value="{$vo.level_id}">{$vo.level_name}</option>
                  {/volist}
                 </select>
                </div>

              </div>
             <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">真实姓名</label>
                <div class="layui-input-inline">
                  <input type="text" name="realname"  placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"> {:about('如果是个人，请用个人真实姓名；如果是公司，请填写公司名称')}</div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">性别</label>
                <div class="layui-input-inline" >
                     <input type="radio" name="gender" value="0" title="男" checked>
                     <input type="radio" name="gender" value="1" title="女" >
                </div>

              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">登陆密码</label>
                <div class="layui-input-inline">
                <input type="password" name="password"  lay-verify="password" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"><span class="orange">*</span> {:about('登陆密码必须6到32位，且不能出现空格,建议数字字母结合使用')}</div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">重复登陆密码</label>
                <div class="layui-input-inline" >
                     <input type="password" name="repassword"  lay-verify="password" placeholder="" autocomplete="off" class="layui-input">
                </div>
                 <div class="layui-form-mid layui-word-aux"><span class="orange">*</span></div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">支付密码</label>
                <div class="layui-input-inline">
                  <div class="layui-input-inline" >
                      <input type="password" name="payword"  placeholder="" autocomplete="off" class="layui-input">
                  </div>
                </div>
                 <div class="layui-form-mid layui-word-aux">{:about('默认为空，初始支付密码和登陆密码一样')}</div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">重复支付密码</label>
                <div class="layui-input-inline">
                  <div class="layui-input-inline" >
                     <input type="password" name="repayword"  placeholder="" autocomplete="off" class="layui-input">
                  </div>
                </div>
                 <div class="layui-form-mid layui-word-aux"></div>
              </div> 
             <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">所在地区</label>
                <div class="layui-input-block">
                 {:area()}
                </div>
              </div>                     
             <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">手机号码</label>
                <div class="layui-input-inline">
                 <input type="text" name="mobile"  placeholder="" autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">邮件</label>
                <div class="layui-input-inline">
                 <input type="text" name="email"  placeholder="" autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">QQ</label>
                <div class="layui-input-inline">
                  <input type="text" name="qq"  placeholder="" autocomplete="off" class="layui-input">
                </div>
              </div>


<blockquote class="layui-elem-quote">认证信息</blockquote>

            
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;">邮箱认证</label>
                <div class="layui-input-inline">
                       <input type="radio" name="is_email" value="1" title="是" >
                     <input type="radio" name="is_email" value="0" title="否" checked>
                </div>
              </div>
       
                <div class="layui-form-item">
                  <label class="layui-form-label" style="width:100px;">状态</label>
                  <div class="layui-input-block">
                   <input type="radio" name="status" value="0" title="待审" >
                    <input type="radio" name="status" value="1" title="正常" checked >
                    <input type="radio" name="status" value="-1" title="禁止访问" >
                  </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:100px;"></label>
                <div class="layui-input-inline">
                   <button class="layui-btn layui-btn-normal"  lay-submit lay-filter="form">确 定</button>

                </div>
              </div>


</form>
</div>

<script>
layui.use(['element', 'layer','form'], function(){
   var  element = layui.element, layer = layui.layer,form = layui.form;

form.verify({
  username: function(value, item){ //value：表单的值、item：表单的DOM对象
       if(value ==''){
         return '用户名不能为空';
       }
    if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
      return '用户名不能有特殊字符';
    }
    if(/(^\_)|(\__)|(\_+$)/.test(value)){
      return '用户名首尾不能出现下划线\'_\'';
    }
    if(/^\d+\d+\d$/.test(value)){
      return '用户名不能全为数字';
    }
  }
  
  //我们既支持上述函数式的方式，也支持下述数组的形式
  //数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
  ,password: [
    /^[\S]{6,32}$/
    ,'登陆密码必须6到32位，且不能出现空格'
  ] 
});      
    


 //监听提交
  form.on('submit(form)', function(data){
    $.post("{:url('user/add')}",$("form").serialize(),function(json){
      if(json.code == 0){
            qilecms.success(json.msg);
            setTimeout(function(){
            qilecms.back();
            },1000);
            }else{
              qilecms.error(json.msg);
            }
    });
    return false; //阻止表单跳转
  });
});
</script>

</body>

</html>